# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -run-pass x86-fixup-LEAs -mtriple=x86_64-gnu-unknown -verify-machineinstrs -mcpu=corei7-avx -o - %s | FileCheck %s
--- |
  ; ModuleID = 'lea-2.ll'
  source_filename = "lea-2.ll"
  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  ;generated using: llc -stop-after x86-pad-short-functions lea-2.ll > leaFinxup64.mir

  ;testleaadd_64_32_1: 3 operands LEA64_32r cannot be replaced with 2 add instructions
  ; but can be replaced with 1 lea + 1 add
  define i32 @testleaadd_64_32_1() {
    ret i32 0
  }

  ;testleaadd_rbp_64_32_1: 3 operands LEA64_32r cannot be replaced with 2 add instructions
  ; where the base is rbp/r13/ebp register but it can be replaced with 1 lea + 1 add
  define i32 @testleaadd_rbp_64_32_1() {
    ret i32 0
  }

  ;test1lea_rbp_64_32_1: 2 operands LEA64_32r where base register is rbp/r13/ebp and can not
  ; be replaced with an add instruction but can be replaced with 1 lea instruction
  define i32 @test1lea_rbp_64_32_1() {
    ret i32 0
  }

  ;test2add_64: 3 operands LEA64r that can be replaced with 2 add instructions
  define i32 @test2add_64() {
    ret i32 0
  }

  ;test2add_rbp_64: 3 operands LEA64r that can be replaced with 2 add instructions
  ; where the base is rbp/r13/ebp register
  define i32 @test2add_rbp_64() {
    ret i32 0
  }

  ;test1add_rbp_64: 2 operands LEA64r where base register is rbp/r13/ebp and can be replaced
  ; with an add instruction
  define i32 @test1add_rbp_64() {
    ret i32 0
  }

  ;testleaadd_64_32: 3 operands LEA64_32r that can be replaced with 1 lea 1 add instructions
  define i32 @testleaadd_64_32() {
    ret i32 0
  }

  ;testleaadd_rbp_64_32: 3 operands LEA64_32r that can be replaced with 1 lea 1 add instructions
  ; where the base is rbp/r13/ebp register
  define i32 @testleaadd_rbp_64_32() {
    ret i32 0
  }

  ;test1lea_rbp_64_32: 2 operands LEA64_32r where base register is rbp/r13/ebp and can be replaced
  ; with a lea instruction
  define i32 @test1lea_rbp_64_32() {
    ret i32 0
  }

  ;testleaadd_64: 3 operands LEA64r that can be replaced with 1 lea 1 add instructions
  define i32 @testleaadd_64() {
    ret i32 0
  }

  ;testleaadd_rbp_64: 3 operands LEA64r that can be replaced with 1 lea 1 add instructions
  ; where the base is rbp/r13/ebp register
  define i32 @testleaadd_rbp_64() {
    ret i32 0
  }

  ;test1lea_rbp_64: 2 operands LEA64r wher base register is rbp/r13/ebp and can be replaced
  ; with a lea instruction
  define i32 @test1lea_rbp_64() {
    ret i32 0
  }

  ;test8: dst = base & scale!=1, can't optimize
  define i32 @test8() {
      ret i32 0
  }

  ;testleaaddi32_64_32: 3 operands LEA64_32r that can be replaced with 1 lea + 1 add instructions where
  ; ADD64ri32 is chosen
  define i32 @testleaaddi32_64_32() {
    ret i32 0
  }

  ;test_leab_rbp_leais_64_32: 2 operands LEA64_32r that can be replaced with LEA_IS form
  ; where the base is rbp/r13/ebp register
  define i32 @test_leab_rbp_leais_64_32() {
    ret i32 0
  }

  ;test_leabi_rbp_leais_64_32: 3 operands LEA64_32r that can be replaced with LEA_IS form
  ; where the base and the index are ebp register and there is offset
  define i32 @test_leabi_rbp_leais_64_32() {
    ret i32 0
  }

  ;testleaadd_rbp_index2_64_32: 3 operands LEA64_32r that cannot replaced with 1 lea 1 add instructions
  ; where the base and the index are ebp register and there is scale
  define i32 @testleaadd_rbp_index2_64_32() {
    ret i32 0
  }

  ;test2addi32_64: 3 operands LEA64r that can be replaced with 2 add instructions where ADD64ri32
  ; is chosen
  define i32 @test2addi32_64() {
    ret i32 0
  }

  ;test_leab_rbp_leais_64: 2 operands LEA64r that can be replaced with LEA_IS form
  ; where the base is rbp/r13/ebp register
  define i32 @test_leab_rbp_leais_64() {
    ret i32 0
  }

  ;test_leabi_rbp_leais_64: 3 operands LEA64r that can be replaced with LEA_IS form
  ; where the base and the index are ebp register and there is offset
  define i32 @test_leabi_rbp_leais_64() {
    ret i32 0
  }

  ;testleaadd_rbp_index2_64: 3 operands LEA64r that can be replaced with 1 lea 1 add instructions
  ; where the base and the index are ebp register and there is scale
  define i32 @testleaadd_rbp_index2_64() {
    ret i32 0
  }

  ;test_skip_opt_64: 3 operands LEA64r that can not be replaced with 2 instructions
  define i32 @test_skip_opt_64() {
    ret i32 0
  }

  ;test_skip_eflags_64: LEA64r that cannot be replaced since its not safe to clobber eflags
  define i32 @test_skip_eflags_64() {
    ret i32 0
  }

  ;test_skip_opt_64_32: 3 operands LEA64_32r that can not be replaced with 2 instructions
  define i32 @test_skip_opt_64_32() {
    ret i32 0
  }

  ;test_skip_eflags_64_32: LEA64_32r that cannot be replaced since its not safe to clobber eflags
  define i32 @test_skip_eflags_64_32() {
    ret i32 0
  }

  define i32 @pr43758() {
    ret i32 0
  }


...
---
name:            testleaadd_64_32_1
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: testleaadd_64_32_1
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $eax = ADD32rr $eax, $ebp, implicit-def $eflags, implicit $rax, implicit $rbp
    ; CHECK: $eax = ADD32ri8 $eax, -5, implicit-def $eflags
    ; CHECK: RET64 $eax
    $eax = LEA64_32r killed $rax, 1, killed $rbp, -5, $noreg
    RET64 $eax

...
---
name:            testleaadd_rbp_64_32_1
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: testleaadd_rbp_64_32_1
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $ebp = ADD32rr $ebp, $eax, implicit-def $eflags, implicit $rbp, implicit $rax
    ; CHECK: $ebp = ADD32ri8 $ebp, -5, implicit-def $eflags
    ; CHECK: RET64 $ebp
    $ebp = LEA64_32r killed $rbp, 1, killed $rax, -5, $noreg
    RET64 $ebp

...
---
name:            test1lea_rbp_64_32_1
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: test1lea_rbp_64_32_1
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $ebp = ADD32rr $ebp, $eax, implicit-def $eflags, implicit $rbp, implicit $rax
    ; CHECK: RET64 $ebp
    $ebp = LEA64_32r killed $rbp, 1, killed $rax, 0, $noreg
    RET64 $ebp

...
---
name:            test2add_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: test2add_64
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $rax = ADD64rr $rax, $rbp, implicit-def $eflags
    ; CHECK: $rax = ADD64ri8 $rax, -5, implicit-def $eflags
    ; CHECK: RET64 $eax
    $rax = LEA64r killed $rax, 1, killed $rbp, -5, $noreg
    RET64 $eax

...
---
name:            test2add_rbp_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: test2add_rbp_64
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $rbp = ADD64rr $rbp, $rax, implicit-def $eflags
    ; CHECK: $rbp = ADD64ri8 $rbp, -5, implicit-def $eflags
    ; CHECK: RET64 $ebp
    $rbp = LEA64r killed $rbp, 1, killed $rax, -5, $noreg
    RET64 $ebp

...
---
name:            test1add_rbp_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: test1add_rbp_64
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $rbp = ADD64rr $rbp, $rax, implicit-def $eflags
    ; CHECK: RET64 $ebp
    $rbp = LEA64r killed $rbp, 1, killed $rax, 0, $noreg
    RET64 $ebp

...
---
name:            testleaadd_64_32
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
  - { reg: '$rbx' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: testleaadd_64_32
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $ebx = LEA64_32r killed $rax, 1, killed $rbp, 0, $noreg
    ; CHECK: $ebx = ADD32ri8 $ebx, -5, implicit-def $eflags
    ; CHECK: RET64 $ebx
    $ebx = LEA64_32r killed $rax, 1, killed $rbp, -5, $noreg
    RET64 $ebx

...
---
name:            testleaadd_rbp_64_32
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
  - { reg: '$rbx' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: testleaadd_rbp_64_32
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $ebx = LEA64_32r killed $rax, 1, killed $rbp, 0, $noreg
    ; CHECK: $ebx = ADD32ri8 $ebx, -5, implicit-def $eflags
    ; CHECK: RET64 $ebx
    $ebx = LEA64_32r killed $rbp, 1, killed $rax, -5, $noreg
    RET64 $ebx

...
---
name:            test1lea_rbp_64_32
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
  - { reg: '$rbx' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: test1lea_rbp_64_32
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $ebx = LEA64_32r killed $rax, 1, killed $rbp, 0, $noreg
    ; CHECK: RET64 $ebx
    $ebx = LEA64_32r killed $rbp, 1, killed $rax, 0, $noreg
    RET64 $ebx

...
---
name:            testleaadd_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
  - { reg: '$rbx' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: testleaadd_64
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $rbx = LEA64r killed $rax, 1, killed $rbp, 0, $noreg
    ; CHECK: $rbx = ADD64ri8 $rbx, -5, implicit-def $eflags
    ; CHECK: RET64 $ebx
    $rbx = LEA64r killed $rax, 1, killed $rbp, -5, $noreg
    RET64 $ebx

...
---
name:            testleaadd_rbp_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
  - { reg: '$rbx' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: testleaadd_rbp_64
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $rbx = LEA64r killed $rax, 1, killed $rbp, 0, $noreg
    ; CHECK: $rbx = ADD64ri8 $rbx, -5, implicit-def $eflags
    ; CHECK: RET64 $ebx
    $rbx = LEA64r killed $rbp, 1, killed $rax, -5, $noreg
    RET64 $ebx

...
---
name:            test1lea_rbp_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
  - { reg: '$rbx' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: test1lea_rbp_64
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $rbx = LEA64r killed $rax, 1, killed $rbp, 0, $noreg
    ; CHECK: RET64 $ebx
    $rbx = LEA64r killed $rbp, 1, killed $rax, 0, $noreg
    RET64 $ebx

...
---
name:            test8
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rdi' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rdi, $rbp
    ; CHECK-LABEL: name: test8
    ; CHECK: liveins: $rdi, $rbp
    ; CHECK: $rbp = KILL $rbp, implicit-def $rbp
    ; CHECK: $r13 = KILL $rdi, implicit-def $r13
    ; CHECK: $r12 = LEA64r $noreg, 2, killed $r13, 5, $noreg
    ; CHECK: $r12 = ADD64rr $r12, killed $rbp, implicit-def $eflags
    ; CHECK: RET64 $r12
    $rbp = KILL $rbp, implicit-def $rbp
    $r13 = KILL $rdi, implicit-def $r13
    $r12 = LEA64r killed $rbp, 2, killed $r13, 5, $noreg
    RET64 $r12

...
---
name:            testleaaddi32_64_32
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: testleaaddi32_64_32
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $eax = ADD32rr $eax, $ebp, implicit-def $eflags, implicit $rax, implicit $rbp
    ; CHECK: $eax = ADD32ri $eax, 129, implicit-def $eflags
    ; CHECK: RET64 $eax
    $eax = LEA64_32r killed $rax, 1, killed $rbp, 129, $noreg
    RET64 $eax

...
---
name:            test_leab_rbp_leais_64_32
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp, $rbx

    ; CHECK-LABEL: name: test_leab_rbp_leais_64_32
    ; CHECK: liveins: $rax, $rbp, $rbx
    ; CHECK: $ebx = LEA64_32r $noreg, 2, killed $rbp, 0, $noreg
    ; CHECK: RET64 $ebx
    $ebx = LEA64_32r killed $rbp, 1, killed $rbp, 0, $noreg
    RET64 $ebx

...
---
name:            test_leabi_rbp_leais_64_32
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rbx' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp, $rbx

    ; CHECK-LABEL: name: test_leabi_rbp_leais_64_32
    ; CHECK: liveins: $rax, $rbp, $rbx
    ; CHECK: $ebx = LEA64_32r $noreg, 2, killed $rbp, 5, $noreg
    ; CHECK: RET64 $ebx
    $ebx = LEA64_32r killed $rbp, 1, killed $rbp, 5, $noreg
    RET64 $ebx

...
---
name:            testleaadd_rbp_index2_64_32
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rbx' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $eax, $ebp, $ebx

    ; CHECK-LABEL: name: testleaadd_rbp_index2_64_32
    ; CHECK: liveins: $eax, $ebp, $ebx
    ; CHECK: $ebx = LEA64_32r killed $rbp, 4, killed $rbp, 5, $noreg
    ; CHECK: RET64 $ebx
    $ebx = LEA64_32r killed $rbp, 4, killed $rbp, 5, $noreg
    RET64 $ebx

...
---
name:            test2addi32_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: test2addi32_64
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: $rax = ADD64rr $rax, $rbp, implicit-def $eflags
    ; CHECK: $rax = ADD64ri32 $rax, 129, implicit-def $eflags
    ; CHECK: RET64 $eax
    $rax = LEA64r killed $rax, 1, killed $rbp, 129, $noreg
    RET64 $eax

...
---
name:            test_leab_rbp_leais_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp, $rbx

    ; CHECK-LABEL: name: test_leab_rbp_leais_64
    ; CHECK: liveins: $rax, $rbp, $rbx
    ; CHECK: $rbx = LEA64r $noreg, 2, $rbp, 0, $noreg
    ; CHECK: RET64 $ebx
    $rbx = LEA64r killed $rbp, 1, $rbp, 0, $noreg
    RET64 $ebx

...
---
name:            test_leabi_rbp_leais_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rbx' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp, $rbx

    ; CHECK-LABEL: name: test_leabi_rbp_leais_64
    ; CHECK: liveins: $rax, $rbp, $rbx
    ; CHECK: $rbx = LEA64r $noreg, 2, $rbp, 5, $noreg
    ; CHECK: RET64 $ebx
    $rbx = LEA64r $rbp, 1, $rbp, 5, $noreg
    RET64 $ebx

...
---
name:            testleaadd_rbp_index2_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rbx' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp, $rbx

    ; CHECK-LABEL: name: testleaadd_rbp_index2_64
    ; CHECK: liveins: $rax, $rbp, $rbx
    ; CHECK: $rbx = LEA64r $noreg, 4, $rbp, 5, $noreg
    ; CHECK: $rbx = ADD64rr $rbx, $rbp, implicit-def $eflags
    ; CHECK: RET64 $ebx
    $rbx = LEA64r $rbp, 4,  $rbp, 5, $noreg
    RET64 $ebx

...
---
name:            test_skip_opt_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rbx' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp, $rbx

    ; CHECK-LABEL: name: test_skip_opt_64
    ; CHECK: liveins: $rax, $rbp, $rbx
    ; CHECK: $rbp = LEA64r killed $rbp, 4, killed $rbp, 0, $noreg
    ; CHECK: RET64 $ebp
    $rbp = LEA64r killed $rbp, 4, killed $rbp, 0, $noreg
    RET64 $ebp

...
---
name:            test_skip_eflags_64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rbp' }
  - { reg: '$rax' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  ; CHECK-LABEL: name: test_skip_eflags_64
  ; CHECK: bb.0 (%ir-block.0):
  ; CHECK:   successors: %bb.1(0x80000000)
  ; CHECK:   liveins: $rax, $rbp, $rbx
  ; CHECK:   CMP64rr $rax, killed $rbx, implicit-def $eflags
  ; CHECK:   $rbx = LEA64r killed $rax, 4, killed $rax, 5, $noreg
  ; CHECK:   JCC_1 %bb.1, 4, implicit $eflags
  ; CHECK:   RET64 $ebx
  ; CHECK: bb.1:
  ; CHECK:   liveins: $rax, $rbp, $rbx
  ; CHECK:   $rbp = LEA64r killed $rbx, 4, killed $rbx, 0, $noreg
  ; CHECK:   $rbp = ADD64ri8 $rbp, 5, implicit-def $eflags
  ; CHECK:   RET64 $ebp
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp, $rbx

    CMP64rr   $rax, killed $rbx, implicit-def $eflags
    $rbx = LEA64r killed $rax, 4, killed $rax, 5, $noreg
    JCC_1 %bb.1, 4, implicit $eflags
    RET64 $ebx
  bb.1:
    liveins: $rax, $rbp, $rbx
    $rbp = LEA64r killed $rbx, 4, killed $rbx, 5, $noreg
    RET64 $ebp

...
---
name:            test_skip_opt_64_32
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rbx' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp, $rbx

    ; CHECK-LABEL: name: test_skip_opt_64_32
    ; CHECK: liveins: $rax, $rbp, $rbx
    ; CHECK: $ebp = LEA64_32r killed $rbp, 4, killed $rbp, 0, $noreg
    ; CHECK: RET64 $ebp
    $ebp = LEA64_32r killed $rbp, 4, killed $rbp, 0, $noreg
    RET64 $ebp

...
---
name:            test_skip_eflags_64_32
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rbp' }
  - { reg: '$rax' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  ; CHECK-LABEL: name: test_skip_eflags_64_32
  ; CHECK: bb.0 (%ir-block.0):
  ; CHECK:   successors: %bb.1(0x80000000)
  ; CHECK:   liveins: $rax, $rbp, $rbx
  ; CHECK:   CMP64rr $rax, killed $rbx, implicit-def $eflags
  ; CHECK:   $ebx = LEA64_32r killed $rax, 4, killed $rax, 5, $noreg
  ; CHECK:   JCC_1 %bb.1, 4, implicit $eflags
  ; CHECK:   RET64 $ebx
  ; CHECK: bb.1:
  ; CHECK:   liveins: $rax, $rbp, $rbx
  ; CHECK:   $ebp = LEA64_32r killed $rbx, 4, killed $rbx, 0, $noreg
  ; CHECK:   $ebp = ADD32ri8 $ebp, 5, implicit-def $eflags
  ; CHECK:   RET64 $ebp
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp, $rbx

    CMP64rr   $rax, killed $rbx, implicit-def $eflags
    $ebx = LEA64_32r killed $rax, 4, killed $rax, 5, $noreg
    JCC_1 %bb.1, 4, implicit $eflags
    RET64 $ebx
  bb.1:
    liveins: $rax, $rbp, $rbx
    $ebp = LEA64_32r killed $rbx, 4, killed $rbx, 5, $noreg
    RET64 $ebp

...
---
name:            pr43758
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
tracksRegLiveness: true
liveins:
  - { reg: '$rax' }
  - { reg: '$rbp' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  maxCallFrameSize: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
body:             |
  bb.0 (%ir-block.0):
    liveins: $rax, $rbp

    ; CHECK-LABEL: name: pr43758
    ; CHECK: liveins: $rax, $rbp
    ; CHECK: DBG_VALUE 0, $noreg
    ; CHECK: NOOP
    ; CHECK: NOOP
    ; CHECK: NOOP
    ; CHECK: NOOP
    ; CHECK: $ebp = ADD32rr $ebp, $eax, implicit-def $eflags, implicit $rbp, implicit $rax
    ; CHECK: NOOP
    ; CHECK: NOOP
    ; CHECK: NOOP
    ; CHECK: NOOP
    ; CHECK: RET64 $ebp
    DBG_VALUE 0, $noreg
    NOOP
    NOOP
    NOOP
    NOOP
    $ebp = LEA64_32r killed $rbp, 1, killed $rax, 0, $noreg
    NOOP
    NOOP
    NOOP
    NOOP
    RET64 $ebp

...
...



